import { useRoutes,Navigate } from 'react-router-dom'
import Home from '../views/Home'
import Error from '../views/Error'
import Movie from '../views/Movie'
import City from '../views/City'
import Hots from '../views/Movie/Hots'
import News from '../views/Movie/News'
import User from '../views/User'
import Detail from '../views/Detail'
const RouterView = () => {
    const routes = useRoutes(
        [
            {
                path: '/',
                element:<Navigate to="/movie/hots"/>
            },
            {
                path: '/home',
                element: <Home />
            },
            {
                path: '/city',
                element: <City />
            },
            {
                path: '*',
                element:<Error/> 
            },
            {
                path: '/movie',
                element:<Movie/> ,
                children:[
                    {
                        path:"movie",
                        element:<Navigate to="/movie/hots"/>
                    },
                    {
                        path:"news",
                        element:<News/>
                    },
                    {
                        path:"hots",
                        element:<Hots/>
                    },

                ]
            },
            {
                path: '/user',
                element:<User/> 
            },
            {
                path: '/detail/:id',
                element:<Detail/> 
            }
        ])
    return routes
}
export default RouterView